###FIRST RUN Study 1 Data Code.R###

####APPENDIX TABLE 4####
atable4 <- matrix(NA,11,9)

##FEDERAL LAW
atable4[1,1:3] <- as.vector(unlist(t.test(study1_fu$MALE[study1_fu$CB_TREAT==1],study1_fu$MALE[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[2,1:3] <- as.vector(unlist(t.test(study1_fu$AGE[study1_fu$CB_TREAT==1],study1_fu$AGE[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[3,1:3] <- as.vector(unlist(t.test(study1_fu$EDUCATION[study1_fu$CB_TREAT==1],study1_fu$EDUCATION[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[4,1:3] <- as.vector(unlist(t.test(study1_fu$INCOME[study1_fu$CB_TREAT==1],study1_fu$INCOME[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[5,1:3] <- as.vector(unlist(t.test(study1_fu$LIBCON[study1_fu$CB_TREAT==1],study1_fu$LIBCON[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[6,1:3] <- as.vector(unlist(t.test(study1_fu$RISK[study1_fu$CB_TREAT==1],study1_fu$RISK[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[7,1:3] <- as.vector(unlist(t.test(study1_fu$UNIONS[study1_fu$CB_TREAT==1],study1_fu$UNIONS[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[8,1:3] <- as.vector(unlist(t.test(study1_fu$WORKS[study1_fu$CB_TREAT==1],study1_fu$WORKS[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[9,1:3] <- as.vector(unlist(t.test(study1_fu$BLACK[study1_fu$CB_TREAT==1],study1_fu$BLACK[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[10,1:3] <- as.vector(unlist(t.test(study1_fu$HISP[study1_fu$CB_TREAT==1],study1_fu$HISP[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[11,1:3] <- as.vector(unlist(t.test(study1_fu$WHITE[study1_fu$CB_TREAT==1],study1_fu$WHITE[study1_fu$CB_TREAT==0])[c(5,3)]))

##FEDERAL CONSTITUTION
atable4[1,4:6] <- as.vector(unlist(t.test(study1_fu$MALE[study1_fu$CB_TREAT==2],study1_fu$MALE[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[2,4:6] <- as.vector(unlist(t.test(study1_fu$AGE[study1_fu$CB_TREAT==2],study1_fu$AGE[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[3,4:6] <- as.vector(unlist(t.test(study1_fu$EDUCATION[study1_fu$CB_TREAT==2],study1_fu$EDUCATION[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[4,4:6] <- as.vector(unlist(t.test(study1_fu$INCOME[study1_fu$CB_TREAT==2],study1_fu$INCOME[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[5,4:6] <- as.vector(unlist(t.test(study1_fu$LIBCON[study1_fu$CB_TREAT==2],study1_fu$LIBCON[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[6,4:6] <- as.vector(unlist(t.test(study1_fu$RISK[study1_fu$CB_TREAT==2],study1_fu$RISK[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[7,4:6] <- as.vector(unlist(t.test(study1_fu$UNIONS[study1_fu$CB_TREAT==2],study1_fu$UNIONS[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[8,4:6] <- as.vector(unlist(t.test(study1_fu$WORKS[study1_fu$CB_TREAT==2],study1_fu$WORKS[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[9,4:6] <- as.vector(unlist(t.test(study1_fu$BLACK[study1_fu$CB_TREAT==2],study1_fu$BLACK[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[10,4:6] <- as.vector(unlist(t.test(study1_fu$HISP[study1_fu$CB_TREAT==2],study1_fu$HISP[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[11,4:6] <- as.vector(unlist(t.test(study1_fu$WHITE[study1_fu$CB_TREAT==2],study1_fu$WHITE[study1_fu$CB_TREAT==0])[c(5,3)]))

##FEDERAL CONSTITUTION + CERTAINTY
atable4[1,7:9] <- as.vector(unlist(t.test(study1_fu$MALE[study1_fu$CB_TREAT==3],study1_fu$MALE[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[2,7:9] <- as.vector(unlist(t.test(study1_fu$AGE[study1_fu$CB_TREAT==3],study1_fu$AGE[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[3,7:9] <- as.vector(unlist(t.test(study1_fu$EDUCATION[study1_fu$CB_TREAT==3],study1_fu$EDUCATION[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[4,7:9] <- as.vector(unlist(t.test(study1_fu$INCOME[study1_fu$CB_TREAT==3],study1_fu$INCOME[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[5,7:9] <- as.vector(unlist(t.test(study1_fu$LIBCON[study1_fu$CB_TREAT==3],study1_fu$LIBCON[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[6,7:9] <- as.vector(unlist(t.test(study1_fu$RISK[study1_fu$CB_TREAT==3],study1_fu$RISK[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[7,7:9] <- as.vector(unlist(t.test(study1_fu$UNIONS[study1_fu$CB_TREAT==3],study1_fu$UNIONS[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[8,7:9] <- as.vector(unlist(t.test(study1_fu$WORKS[study1_fu$CB_TREAT==3],study1_fu$WORKS[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[9,7:9] <- as.vector(unlist(t.test(study1_fu$BLACK[study1_fu$CB_TREAT==3],study1_fu$BLACK[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[10,7:9] <- as.vector(unlist(t.test(study1_fu$HISP[study1_fu$CB_TREAT==3],study1_fu$HISP[study1_fu$CB_TREAT==0])[c(5,3)]))
atable4[11,7:9] <- as.vector(unlist(t.test(study1_fu$WHITE[study1_fu$CB_TREAT==3],study1_fu$WHITE[study1_fu$CB_TREAT==0])[c(5,3)]))
#######################
